﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YGame.Base;
using System.Diagnostics;

namespace YGame.GameServer
{


	public class GatewayConnect : IGatewayConnect
	{
		public event ReceiveDataHandler ReceiveData;

		public GatewayConnect()
		{
		}

		public void Start()
		{
		}

		public void Stop()
		{
		}


		public void Send(string data)
		{
			
		}

		public void OnRecieve(string data)
		{
			Trace.Write(String.Format("YGame.GameServer.GatewayConnect OnRecieve: {0}\r\n", data));
			ReceiveDataArgs e = new ReceiveDataArgs() { Data = System.Text.Encoding.UTF8.GetBytes(data) };
			if (ReceiveData!=null)
			{
				ReceiveData(this, e);
			}
		}

		public void OnRecieve(byte[] data)
		{
			Trace.Write(String.Format("YGame.GameServer.GatewayConnect OnRecieve: {0}\r\n", BaseFrame.ShareFunction.TextEx.Binary2HexString(data)));
			ReceiveDataArgs e = new ReceiveDataArgs() { Data = data };
			if (ReceiveData != null)
			{
				ReceiveData(this, e);
			}
		}
	}
}
